from fastapi import FastAPI, Request
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates

app = FastAPI()


app.mount("/static", StaticFiles(directory="static"), name="static")


templates = Jinja2Templates(directory="templates")


@app.get("/")
async def main(request: Request):
    items = ["路人甲", "路人乙", "路人丙"]
    return templates.TemplateResponse(
        "list.html",
        {
            "request": request,
            "title": "这是标题",
            "items": items,
        },
    )
